# -*- coding: utf-8 -*-
# @Time    : 2018/8/15 14:19
# @Author  : 聂家利
# @Email   : 1073438012@qq.com
# @File    : baseapi.py
# @Software: PyCharm

import requests
from its_auth.config import config


class BaseConn(object):

    def __init__(self):

        self.url = 'http://'+config['server_ip']+':'+bytes(config['port'])+'/'+config['project_name']
        # print('Access the server address url', self.url)

    def common(self, controller, kwargs):
        r = requests.get(self.url + controller, params=kwargs)
        if r.json()['msg']:
            data = r.json()['data']
        else:
            data = ''
            print(r.url)
        return data


